home *** CD-ROM | disk | FTP | other *** search
- /*
- File: ModemDriver.h
-
- Contains: xxx put contents here xxx
-
- Version: xxx put version here xxx
-
- Copyright: © 1999 by Apple Computer, Inc., all rights reserved.
-
- File Ownership:
-
- DRI: xxx put dri here xxx
-
- Other Contact: xxx put other contact here xxx
-
- Technology: xxx put technology here xxx
-
- */
-
- #ifndef _MODEMDRIVER_
- #define _MODEMDRIVER_
-
- typedef struct{
- USBPB pb;
- UInt8 *errorString;
- UInt16 interfacenum;
- USBDeviceRef deviceRef;
- USBPipeRef interrupt;
- USBPipeRef bulkIn;
- USBPipeRef bulkOut;
- USBDeviceDescriptorPtr deviceDescriptor;
- UInt8 modemStatus;
- UInt8 lineStatus;
- UInt8 onError;
- UInt8 retries;
- Boolean DTRClose; // true means don't negate DTR
- UInt16 modemUSBStatus; // Modem and line status USB
- UInt16 lineState; // Current USB line state
- LineParms Line_Settings; // USB current line settings
- } serPB;
-
- enum{
- kReset = 0,
- kCommConfig = 1,
- kSetConfig = 2,
- kGetCommInterface = 3,
- kSetCommInterface = 4,
- kConfigureCommInterface = 5,
- kGetInterruptEndpoint = 6,
- kDataConfig = 7,
- kGetDataInterface = 8,
- kConfigureDataInterface = 9,
- kGetBulkOutEndpoint = 10,
- kGetBulkInEndpoint = 11,
- kConfigDone = 12,
-
- kEndpointStall = 1,
- kStallDone = 2,
-
- kResetDevice = 1,
- kResetDone = 2,
-
- kAvailableStatus = 'okok'
- };
-
- /********************************************************************************************/
- //
- // Prototypes
- //
- /********************************************************************************************/
-
- void USBStatus(UInt32 level, USBDeviceRef ref, void *pointer, UInt32 value);
- static Boolean immediateError(OSStatus err);
- static void ConfigurationHandler(USBPB *pb);
- static void ResetInterruptPB(USBPB *pb);
- static void interruptCompletion(USBPB *pb);
- static void StartStatusMonitor(USBPipeRef interruptPipe);
- static void syncCompletion(USBPB *pb);
- Boolean TimeoutPrevRequest(void);
- Boolean TimeoutStallRequest(void);
- Boolean TimeoutDelayRequest(void);
- void USBSetBaudRate(UInt32 baudRate);
- void USBSetLineCoding(LineParms Line_Coding);
- void USBSetControlLineState(void);
- void USBSetDTRState(Boolean state);
- void USBSetRTSState(Boolean state);
- void USBSendBreak(Boolean state);
- void USBSetCloseDTR(void);
- UInt8 USBGetDCDValue(void);
- OSStatus modemDriverEntry(USBDeviceRef device, USBDeviceDescriptor *desc);
- static void InitializePB(USBPB *pb, USBDeviceRef ref, USBCompletion handler);
- void readCompletion(USBPB *pb);
- void USBStartReadPolling();
- void USBStopReadPolling(void);
- void writeCompletion(USBPB *pb);
- OSStatus USBSerialWrite(IOParam *pb);
- void KillUSBIO(void);
- void InitLineCoding(LineParms Line_Coding);
- void DoDelay(void);
- static void delayHandler(USBPB *pb);
- void ClearDevice(void);
- static void stallHandler(USBPB *pb);
- void ResetDevice(void);
- static void ResetHandler(USBPB *pb);
- UInt8 Asciify(UInt8 i);
-
- #if ((DebugOn > 0) && (LogOn > 0))
- void USBLogData(UInt8 Dir, UInt32 Count, UInt8 *buf);
- #endif
-
- #endif
-